﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace Xqsys.DAL
{
    public class FriendLink
    {
        /// <summary>
        /// 添加友情链接
        /// </summary>
        /// <param name="friendLink"></param>
        /// <returns></returns>
        public bool AddFriendLink(MODEL.FriendLink friendLink)
        {
            SqlParameter[] param=new SqlParameter[]
            {
                new SqlParameter("@friendID",friendLink.FriendID),
                new SqlParameter("@name",friendLink.Name),
                new SqlParameter("@url",friendLink.Url)
            };
            return COM.SqlHelper.ExecuteNonQuery("sp_AddFriendLink",param);
        }
        /// <summary>
        /// 删除友情链接
        /// </summary>
        /// <param name="friendid"></param>
        /// <returns></returns>
        public bool deleteFriendLink(int friendid)
        {
            SqlParameter[] parms = new SqlParameter[]
               {
                   new SqlParameter("@friendid",friendid)
               };
            return COM.SqlHelper.ExecuteNonQuery("sp_DeleteFriendLink", parms);
        }
        /// <summary>
        /// 更新友情链接的数据
        /// </summary>
        /// <param name="friendid"></param>
        /// <returns></returns>
        public bool UpdateFriendLink(MODEL.FriendLink friendLink)
        {
            SqlParameter[] parms = new SqlParameter[]
            {
                new SqlParameter("@friendid",friendLink.FriendID),
                new SqlParameter("@name",friendLink.Name),
                new SqlParameter("@url",friendLink.Url)
            };
            return COM.SqlHelper.ExecuteNonQuery("sp_UpdateFriendLink", parms);
        }
        /// <summary>
        /// 查找友情链接
        /// </summary>
        /// <param name="friendid"></param>
        /// <returns></returns>
        public DataSet SelectFriendLink()
        {
            return COM.SqlHelper.ExecuteQuery("sp_SelecteFriendLink");
        }
    }
}
